﻿using System;
using System.Windows.Forms;

namespace xfsale.ui
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {
                xfsale.lib.App.Init();

                DevExpress.Skins.SkinManager.EnableFormSkins();
                DevExpress.LookAndFeel.UserLookAndFeel.Default.SkinName = "Caramel";

                Application.ThreadException += ErrorHandler;
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                //WinLogin login = new WinLogin();
                //if (login.ShowDialog() == DialogResult.OK)
                {
                    xfsale.lib.App.Global.RegionCode = System.Configuration.ConfigurationSettings.AppSettings["RegionCode"];
                    xfsale.lib.App.Global.BranchCode = System.Configuration.ConfigurationSettings.AppSettings["BranchCode"];
                    xfsale.lib.App.Global.NetCode = System.Configuration.ConfigurationSettings.AppSettings["NetCode"];
                    xfsale.lib.App.Global.OpCode = "00000001";
                    xfsale.lib.App.Global.OpName = "叶卫国";                    
                    Application.Run(new WinMain());
                }

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                Application.Exit();
            }
            finally
            {
                xfsale.lib.App.Dispose();
            }
        }

        static void ErrorHandler(object sender, System.Threading.ThreadExceptionEventArgs e)
        {
            MessageBox.Show(e.Exception.Message);
            Application.Exit();
        }
    }
}
